﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace GDM.Hogar.Controles.ControlesPersonalizados.Grilla
{
    public partial class CustomFlexGrid : DataGridView, ISupportPaging
    {
        public CustomFlexGrid()
        {
            ReadOnly = true;
            AutoGenerateColumns = false;

            SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            AllowUserToAddRows = false;
            AllowUserToDeleteRows = false;
            AllowUserToOrderColumns = false;
            RowHeadersVisible = false;
            MultiSelect = false;
            UpperBound = 100;
            ScrollBars = ScrollBars.Both;
            AlternatingRowsDefaultCellStyle = new DataGridViewCellStyle { BackColor = Color.Lavender };
            SuspendLayout();
        }

        public Action CleanUp { get; set; }

        public bool Configured { get; set; }

        public int CurrentPage { get; set; }

        public Action EndConfigure { get; set; }

        public Action OnGotoFirst { get; set; }

        public Action OnGotoLast { get; set; }

        public Action OnGotoNext { get; set; }

        public Action OnGotoPrev { get; set; }

        public Action OnPageChange { get; set; }

        public int PageSize { get; set; }

        public Func<int> TotalPages { get; set; }

        public Func<int> TotalRecords { get; set; }

        public int UpperBound { get; set; }

        protected override bool DoubleBuffered
        {
            get
            {
                return true;//Evitar parpadeo
            }
            set { }
        }
    }
}